/*This is the do file for the article "Make One for the Team."
It contains code for replicating models from regression tables A7-A10 and producing Figures 1-3, A1-A3.*/

ssc install schemepack, replace
ssc install coefplot
ssc install combomarginsplot

use "C:\Users\admin\Desktop\DATA File\Data for Replication - Make One For The Team.dta"
 
*CODE FOR RUNNING MODELS FROM TABLE A7:

*Model 1

reg group_pronat01 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south if !missing(cn301) [pw=weight]

*Model 2

reg group_pronat01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Model 3

reg group_pronat01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]



*CODE FOR RUNNING MODELS FROM TABLE A8:

*Reverse Declining Fertility

*Model 1

reg fertility01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Model 2

reg fertility01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Perpetuate Religious Heritage

*Model 1

reg relheritage01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Model 2

reg relheritage01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Perpetuate Racial Heritage

*Model 1

reg raceheritage01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Model 2

reg raceheritage01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Secure Political Influence

*Model 1

reg politics01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]

*Model 2

reg politics01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south [pw=weight]



*CODE FOR RUNNING MODELS FROM TABLE A9:

*Model 1

reg group_pronat01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn301##c.fulfilling01 [pw=weight]

*Model 2

reg group_pronat01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn301##c.tradindex01 [pw=weight]

*Model 3

reg group_pronat01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn301##c.ideo01 [pw=weight]

*Model 4

reg group_pronat01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn301##c.partisan01 [pw=weight]

*Model 1

reg group_pronat01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn401##c.fulfilling01 [pw=weight]

*Model 2

reg group_pronat01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn401##c.tradindex01 [pw=weight]

*Model 3

reg group_pronat01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn401##c.ideo01 [pw=weight]

*Model 4

reg group_pronat01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn401##c.partisan01 [pw=weight]



*CODE FOR RUNNING MODELS FROM TABLE A10

*Model 1

reg group_pronat01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn301##i.gender [pw=weight]

*Model 2

reg group_pronat01 c.cn301 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn301##i.race [pw=weight]

*Model 3

reg group_pronat01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn401##i.gender [pw=weight]

*Model 4

reg group_pronat01 c.cn401 c.fulfilling01 c.tradindex01 c.ideo01 c.partisan01 i.reltrad c.relindex01 c.age01 i.gender i.race i.married i.child18 c.educ01 i.income i.south c.cn401##i.race [pw=weight]



*CODE FOR PRODUCING FIGURE 1, FROM TABLE A7, MODELS 2 AND 3

*Run models 2 and 3. After each model, run:
coefplot, scheme(gg_tableau) drop(_cons)
*Labels are adjusted in graph editor
*The 2 forrest plots are combined with the bylabel() function.



*CODE FOR PRODUCING FIGURE 2, FROM TABLE A8, MODELS 1-8

*Run models 1-8. After each model, run:
coefplot, scheme(gg_tableau) drop(_cons)
*Labels are adjusted in graph editor
*The 8 forrest plots are combined with the bylabel() function.



*CODE FOR PRODUCING FIGURE 3, FROM TABLE A9, MODELS 2 (cn x social traditionalism)

*Run model 2 (with cn301)
margins, at(cn301=(0(.2)1) tradindex01=(0 .5 1)) atmeans
marginsplot, scheme(gg_tableau)
*Labels are adjusted in graph editor 

*Run model 2 (with cn401)
margins, at(cn401=(0(.2)1) tradindex01=(0 .5 1)) atmeans
marginsplot, scheme(gg_tableau)
*Labels are adjusted in graph editor
*The two figures are then combined using the graph combine command.

*Code for producing Figures A1-A3 in the Appendix follow the same pattern.